package com.xx.sg.own.entity;

import com.alibaba.fastjson2.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xx.sg.handler.TimestampToLocalDateTimeReader;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("sg_user")
public class User {

    @TableId(value = "id", type = IdType.ASSIGN_UUID)
    @JSONField(name = "id")
    private String id;

    @TableField(value = "emp")
    @JSONField(name = "ty_emp")
    private String emp;

    @TableField(value = "login_name")
    @JSONField(name = "ty_login_name")
    private String loginName;

    @TableField(value = "real_name")
    @JSONField(name = "ty_real_name")
    private String realName;

    @TableField(value = "age")
    @JSONField(name = "ty_age")
    private Integer age;

    @TableField(value = "gender")
    @JSONField(name = "ty_gender")
    private String gender;

    @TableField(value = "telephone")
    @JSONField(name = "ty_telephone")
    private String telephone;

    @TableField(value = "email")
    @JSONField(name = "ty_email")
    private String email;

    @TableField(value = "account_status")
    @JSONField(name = "ty_account_status")
    private String accountStatus;

    @TableField(value = "is_delete")
    @JSONField(name = "ty_is_delete")
    private Integer isDelete;

    @TableField(value = "safe_step")
    @JSONField(name = "ty_safe_step")
    private String safeStep;

    @TableField(value = "order_num")
    @JSONField(name = "ty_order")
    private Integer orderNum;

    @TableField(value = "work")
    @JSONField(name = "ty_work")
    private String work;

    @TableField(value = "post")
    @JSONField(name = "ty_post")
    private String post;

    @TableField(value = "sup_name")
    @JSONField(name = "ty_sup_name")
    private String supName;

    @TableField(value = "sup_id")
    @JSONField(name = "ty_sup_id")
    private String supId;

    @TableField(value = "dept_ids")
    @JSONField(name = "dept_ids")
    private String deptIds;

    @TableField(value = "card")
    @JSONField(name = "ty_card")
    private String card;

    @TableField(value = "create_time")
    @JSONField(name = "ty_add_time", deserializeUsing = TimestampToLocalDateTimeReader.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;

    @TableField(value = "update_time")
    @JSONField(name = "update_time", deserializeUsing = TimestampToLocalDateTimeReader.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime updateTime;

    @TableField(exist = false)
    private String devNo;

    @TableField(exist = false)
    private boolean duty;
}
